<template>
    <view>
        <image :src='src' style="width: 100vw;height: 100vw;" mode="aspectFit"></image>
        <reaee-video-cover-extractor :path="tempFilePath" @success='success' @error='error' />
        <button @tap="select">加载视频</button>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                // 视频临时地址
                tempFilePath: 'http://admin:sjgq12345@192.168.1.33/onvif-http/snapshot?profile_1',
                // 封面图片地址
                src: ''
            }
        },
        methods: {
            // 选择视频
            async select() {
                const o = await uni.chooseVideo()
                const [a, {tempFilePath}] = o
                if(tempFilePath){
                    this.tempFilePath = tempFilePath
                }else{
                    this.tempFilePath = ''
                }
            },

            // 视频封面提取成功
            success(o) {
                this.src = o
            },

            // 视频封面提取失败
            error(e) {
                console.log('error', e);
            }
        }
    }
</script>